#!/bin/bash

#Usage: ./start_master.sh $ports

. ./libs.sh

echo "starting..."

TIMEOUT=2000

echo "bind $(getInternalIp)" > redis.conf

for PORT in "$@"
do
    if isNumber ${PORT}
    then
        redis-server redis.conf --port ${PORT} \
            --cluster-enabled yes --cluster-config-file nodes-${PORT}.conf \
            --cluster-node-timeout ${TIMEOUT} --appendonly yes \
            --appendfilename appendonly-${PORT}.aof --dbfilename dump-${PORT}.rdb \
            --logfile ${PORT}.log --daemonize yes
    fi
done